#!/usr/bin/python
# coding:utf-8
# auther:DT
# 2017-08-08_14-35-02
gcount = 0


def global_test():
    print (gcount)


def global_counter():
    global gcount
    gcount +=1
    return gcount

 
def global_counter_test():
     print(global_counter())
     print(global_counter())
     print(global_counter())


global_counter_test()
print("===============================")


def make_counter():
    count = 0

    def counter():
        nonlocal count
        count += 1
        return count
    return counter


mc = make_counter()
print(mc())
print(mc())
print(mc())
